﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace System
{
    public static class Guard
    {
        [DebuggerStepThrough]
        public static void NotNull(object argumentValue, string argumentName)
        {
            if (argumentValue == null)
                throw new ArgumentNullException(argumentName);
        }


        [DebuggerStepThrough]
        public static void NotNullOrEmpty(string argumentValue, string argumentName = "")
        {
            if (string.IsNullOrEmpty(argumentValue))
                throw new ArgumentNullException(argumentName);
        }

        [DebuggerStepThrough]
        public static void NotNull(object obj)
        {
            if (obj == null)
                throw new ArgumentNullException();
        }

        [DebuggerStepThrough]
        public static void NotEmpty<T>(T obj)
            where T : ICollection<T>
        {
            if (obj == null)
                throw new ArgumentNullException();
            if (obj.Count < 1)
                throw new ArgumentException();
        }

        [DebuggerStepThrough]
        public static void Greater(int val, int compared)
        {
            if (val <= compared)
                throw new ArgumentException();
        }

        [DebuggerStepThrough]
        public static void GreaterEqual(int val, int compared)
        {
            if (val < compared)
                throw new ArgumentException();
        }

        [DebuggerStepThrough]
        public static void Less(int val, int compared)
        {
            if (val >= compared)
                throw new ArgumentException();
        }

        [DebuggerStepThrough]
        public static void LessEqual(int val, int compared)
        {
            if (val > compared)
                throw new ArgumentException();
        }

    }


}
